import { createRouter, createWebHistory } from 'vue-router'

// 导入组件
import LoginVue from '@/views/Login.vue'
import LayoutVue from '@/views/Layout.vue'
import WarehouseManageVue from '@/views/warehouse/WarehouseManage.vue'
import GoodsManageVue from '@/views/warehouse/GoodsManage.vue'
import UserAvatarVue from '@/views/user/UserAvatar.vue'
import UserInfoVue from '@/views/user/UserInfo.vue'
import UserResetPasswordVue from '@/views/user/UserResetPassword.vue'
import VideoManage from '@/views/video/videoManage.vue'
import UnityView from '@/views/UnityView.vue' // 导入 Unity 组件

// 定义路由关系
const routes = [
  {
    path: '/',
    name: 'Layout',
    component: LayoutVue,
    redirect: '/video/videoManage',
    children: [
      {
        path: '/video/videoManage',
        name: 'videoManage',
        component: VideoManage
      },
      {
        path: '/warehouse/warehouseManage',
        name: 'warehouseManage',
        component: WarehouseManageVue
      },
      {
        path: '/warehouse/goodsManage',
        name: 'goodsManage',
        component: GoodsManageVue
      },
      {
        path: '/user/userInfo',
        name: 'UserInfo',
        component: UserInfoVue
      },
      {
        path: '/user/userResetPassword',
        name: 'UserResetPassword',
        component: UserResetPasswordVue
      },
      {
        path: '/unity',
        name: 'Unity',
        component: UnityView
      }
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: LoginVue
  }
]

// 创建路由器
const router = createRouter({
  history: createWebHistory(),
  routes: routes
})

// 导出路由器
export default router
